<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<svg width="400" height="400">
    <rect id="target" x="10" y="110" width="80" height="80">
        <set attributeType="XML" attributeName="x" to="210" />
    </rect>
</svg>
<script>
'use strict';

// From UseCounter.h
var SVGSMILElementInsertedAfterLoad = 1457;

var testHandle = async_test("SMIL element inserted after load is counted");

window.onload = function() {
    testHandle.step(function() {
        var animation = document.createElementNS("http://www.w3.org/2000/svg", "set");
        animation.setAttribute("attributeType", "XML");
        animation.setAttribute("attributeName", "y");
        animation.setAttribute("value", "310");
        assert_false(internals.isUseCounted(document, SVGSMILElementInsertedAfterLoad));
        target.appendChild(animation);
        assert_true(internals.isUseCounted(document, SVGSMILElementInsertedAfterLoad));
    });
    testHandle.done();
};

</script>
